/* Layout */
import Layout from '../views/layout/Layout';

// utils
import { mapToArray } from '@/utils/base';

const _import = require(`./_import_${process.env.NODE_ENV}`);

// 佣金结算权限
export const commFeeCaseRoleType = {
  add: 'add', /* 添加佣金设置 */
  edit: 'edit', /* 编辑佣金设置 */
  settle: 'settle', /* 有效会员配置 */
  fee: 'fee', /* 存提手续费配置 */
  creditFeeSet: 'credit-fee-set', /* 上分手续费配置 */
  delete: 'delete', /* 删除佣金方案 */
};
// 现金网佣金方案
export const commCaseRoleType = {
  add: 'add', /* 添加现金网佣金方案 */
  edit: 'edit', /* 编辑佣金方案 */
  delete: 'delete', /* 删除佣金方案 */
};
// 佣金结算权限
export const commSettleRoleType = {
  batchAudit: 'batch-audit', /* 批量审核 */
  firstAudit: 'first-audit', /* 初审 */
  secondAudit: 'second-audit', /* 终审 */
  export: 'export', /* 导出 */
  subordExport: 'subordinate-commission-export', /* 下级佣金导出 */
  virtual: 'virtual', /* 虚拟数据查看 */
};

// 结算历史
export const commSettHistoryType = {
  virtual: 'virtual', /* 虚拟数据查看 */
};

// 存提手续费记录
export const commRechWithRecordType = {
};

// 结算历史
export const commRenewRecordType = {
  virtual: 'virtual', /* 虚拟数据查看 */
};

export default [
  {
    path: '/commission',
    component: Layout,
    redirect: 'noredirect',
    name: 'commission',
    meta: {
      title: '代理佣金',
      icon: 'peoples',
      roles: [],
    },
    children: [
      {
        path: 'commission-fee-case',
        name: 'commission-fee-case',
        component: _import('agency/commission/index'),
        meta: {
          title: '手续费方案',
          roles: mapToArray(commFeeCaseRoleType),
        },
      },
      {
        path: 'commission-case',
        name: 'commission-case',
        component: _import('agency/commission/commissionCase'),
        meta: {
          title: '现金网佣金方案',
          roles: mapToArray(commCaseRoleType),
        },
      },
      {
        path: 'commission-settle',
        name: 'commission-settle',
        component: _import('agency/commission/settlement/audit'),
        meta: {
          title: '佣金结算',
          roles: mapToArray(commSettleRoleType),
        },
      },
      {
        path: 'commission-settle-history',
        name: 'commission-settle-history',
        component: _import('agency/commission/settlement/logs'),
        meta: {
          title: '结算历史',
          roles: mapToArray(commSettHistoryType),
        },
      },
      {
        path: 'commission-recharge-withdraw-records',
        name: 'commission-recharge-withdraw-records',
        component: _import('agency/commission/commissionRechargeWithdrawRecords'),
        meta: {
          title: '存提手续费记录',
          roles: mapToArray(commRechWithRecordType),
        },
      },
      {
        path: 'commission-renew-record',
        name: 'commission-renew-record',
        component: _import('agency/commission/renewRecord'),
        meta: {
          title: '代充手续费记录',
          roles: mapToArray(commRenewRecordType),
        },
      },
      // 新增
      // 代充返利方案
      {
        path: 'commission-rebate-plan',
        name: 'commission-rebate-plan',
        component: _import('agency/commission/rebate-plan/index'),
        meta: {
          title: '代充返利方案',
          roles: mapToArray(commFeeCaseRoleType),
        },
      },
      {
        path: 'commission-agent-rebate-settlement',
        name: 'commission-agent-rebate-settlement',
        component: _import('agency/commission/agent-recharge-rebate-settlement/index'),
        meta: {
          title: '代充返利结算',
          roles: mapToArray(commSettleRoleType),
        },
      },
    ],
  },
];
